package com.oauth.facebook.server.global;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Required;

import com.oauth.facebook.server.service.FacebookService;
import com.oauth.service.application.global.ApplicationGlobalServiceAdapter;
import com.oauth.service.application.global.beans.Birthday;

public class FacebookGlobalService extends ApplicationGlobalServiceAdapter {

	private FacebookService mFacebookService;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.oauth.service.application.global.ApplicationGlobalServiceAdapter#
	 * updateStatus(java.lang.Long, java.lang.String)
	 */
	@Override
	public boolean updateStatus(Long pMemberId, String pStatusText) {
		// mOrkutOAuthService.
		try {
			mFacebookService.updateStatus(pStatusText, pMemberId);
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return true;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.oauth.service.application.global.ApplicationGlobalServiceAdapter#
	 * getUpcomingBirthdays(java.lang.Long, int)
	 */
	@Override
	public List<Birthday> getUpcomingBirthdays(Long pMemberId, int pBirthdayInterval) {
		try {
			return mFacebookService.getUpcomingBirthdays(pMemberId, pBirthdayInterval);
		} catch (Exception e) {
			e.printStackTrace();
			return new ArrayList<Birthday>(1);
		}
	}

	/**
	 * @param pFacebookService
	 *            the facebookService to set
	 */
	@Required
	public void setFacebookService(FacebookService pFacebookService) {
		mFacebookService = pFacebookService;
	}

}
